package com.framework.service.config.initDataConfig;

import com.framework.service.common.CacheService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Configuration;

/**
 * @author 龘鵺
 * @version 1.0
 * @className com.framework.service.config.initDataConfig
 * @description 初始化角色，菜单，按钮参数
 * @datetime 2024-12-12 10:33:48
 */
@Configuration
public class InitDataConfig implements CommandLineRunner {
    private Logger log = LoggerFactory.getLogger(InitDataConfig.class);
    @Autowired
    private CacheService cacheServiceImpl;

    /**
     * @param args 1 参数数组
     * @title 初始化角色，菜单，按钮到redis中
     * @description 初始化角色，菜单，按钮到redis中
     * @author 龘鵺
     * @datetime 2024-12-12 10:33:48
     */
    @Override
    public void run(String... args) throws Exception {
        log.info("数据初始化 - 开始");
        cacheServiceImpl.initCache();
        cacheServiceImpl.initCreateBucket();
        cacheServiceImpl.initDataSource();
        log.info("数据初始化 - 结束");
    }
}
